package codingforgreat.lchot150;

public class Lc242 {
    public boolean isAnagram(String s, String t) {
        if(s.length() != t.length()){
            return false;
        }
        int[] ch = new int[26];
        char[] str = s.toCharArray();
        char[] tar = t.toCharArray();
        for(int i = 0;i < str.length;i++){
            ch[str[i] - 'a']++;
        }
        for(int i = 0;i < tar.length;i++){
            ch[tar[i] - 'a']--;
            if(ch[tar[i] - 'a'] < 0){
                return false;
            }
        }
        return true;
    }
}
